import { request } from "@/utils/request.js"
import operationBusinessMockData from "@/mock/data/operationBusiness/index.js"


function query(mockDataName) {
    const { integrationData, catalog } = operationBusinessMockData;
    const { data: result } = integrationData[catalog.indexOf(mockDataName)];
    return { data: result }
}

/**
 * 工单流转切换卡片
 * @param {} options 
 * @returns 
 */
export function getWorkCardData(options = {}) {
    return request({
        url: `sjzt/ywyw/gdlz`,
        method: 'get',
        mockFilter: (req, mockDataName = "gdlz") => {
            return query(mockDataName)
        },
        params: options
    })
}

/**
 * 工单流转柱状图
 * @param {} options 
 * @returns 
 */
export function getWorkBarData(options = {}) {
    return request({
        url: `sjzt/ywyw/gdlzzzt`,
        method: 'get',
        mockFilter: (req, mockDataName = "gdlzzzt") => {
            return query(mockDataName)
        },
        params: options
    })
}

/**
 * 高频问题应用
 * @param {} options 
 * @returns 
 */
export function getHighFrequencyData(options = {}) {
    return request({
        url: `sjzt/ywyw/gpwtyy`,
        method: 'get',
        mockFilter: (req, mockDataName = "gpwtyy") => {
            return query(mockDataName)
        },
        params: options
    })
}